<?php

class Controller extends Zend_Controller_Action
{

	protected $user;
	protected $request;
	
	public function getUser()
	{
		Zend_Session::start();
		$namespace = new Zend_Session_Namespace('Zend_Auth');
		$auth = Zend_Auth::getInstance();
		if (!$auth->hasIdentity())
		if ($namespace->storage)
		{
			$user = array();
			$user['id'] = $namespace->storage->id;
			$user['username'] = $namespace->storage->username;
			$user['name'] = $namespace->storage->name;
			$user['role'] = $namespace->storage->role;
			return $user;
		}
		else
		{
			return array('id'=>'0','username'=>'guest','name'=>'guest','role'=>'guest');
		}
		
		
		
		
	}
	
	public function preDispatch()
	{
		$auth = Zend_Auth::getInstance();
		if (!$auth->hasIdentity())
		{
			$this->_redirect('auth/login');
		}

		
		
		
	}

	
    public function init()
    {
		$this->initView();
		$this->view->baseUrl = $this->_request->getBaseUrl();
    }

    public function indexAction()
    {

    }

}

